package com.wellsantos.dgwt.papelaria.client;

import java.util.ArrayList;
import java.util.List;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.user.client.Window;
import com.wellsantos.dgwt.client.Action;
import com.wellsantos.dgwt.client.ActionCommand;
import com.wellsantos.dgwt.papelaria.client.theme.PapelariaTheme;
import com.wellsantos.dgwt.papelaria.client.view.PapelariaView;

/*
 * FIXME papelaria não funciona no FF 2.0 portable,
 *       o engraçado é que funciona no Netscape9, 
 *       deve ser algo diferente na versão do gecko
 */
public class Papelaria implements EntryPoint {

    private static PapelariaTheme theme;

    private static PapelariaView mainView;
    
    
    @Override
    public void onModuleLoad() {
        
    }

    
    public static PapelariaView getMainView() {
        if (mainView == null){
            mainView = new PapelariaView();
        }
        return mainView;
    }


    public static PapelariaTheme getTheme() {
        if (theme == null){
            theme = new PapelariaTheme();
        }
        return theme;
    }

    
    public static List<Action> getMenuActions(){
        List<Action> actions = new ArrayList<Action>(2);
        
        actions.add(new ActionCommand() {
            @Override
            public String getLabel() {
                return "CADERNOS";
            }
            @Override
            public void onClick(ClickEvent event) {
                Window.alert("OEEEE");
            }
        });
        
        actions.add(new ActionCommand() {
            @Override
            public String getLabel() {
                return "LIVROS";
            }
            @Override
            public void onClick(ClickEvent event) {
                Window.alert("TCHAU");
            }
        });
        
        return actions;
    }
    
}
